<?php
namespace App\Http\Controllers\ShopWeb;

use App\Http\Controllers\WebController;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Facades\Auth;

class CommonController extends WebController
{
    //帮助中心
    public function help() {
         return view('shop.mycenter.help');
    }
    //用户协议
    public function agreement() {
        return view('shop.mycenter.agreement');
    }
    public function appDownload() {
        $platform = '';
        $userAgent = $this->request->header('user-agent');
        if(strstr($userAgent, "FBWiOSApp")) {
            $platform = "iOS";
        } elseif(strstr($userAgent, "FBWAndroidApp")) {
            $platform = "Android";
        } elseif(stripos($userAgent, 'Android')) {
            $platform = 'Android';
        } elseif(stripos($userAgent, "iphone")) {
            $platform = "iOS";
        } elseif(stripos($userAgent, "ipad")) {
            $platform = "iOS";
        }
        if(stripos($userAgent, 'MicroMessenger')) {
            $isweixin = '1';
        } else {
            $isweixin = '0';
        }
        $androidDownloadUrl = 'http://file.fbw-china.com/download/fbwbusiness.apk';
        $iosDownloadUrl = '';
        $data = [
            'platform' => $platform,
            'isweixin' => $isweixin,
            'iosdownloadurl' => $iosDownloadUrl,
            'androiddownloadurl' => $androidDownloadUrl,
        ];
        return view('shop.mycenter.app_download', $data);
    }
}